from django.db import models
from utils.basemodel import BaseModel
# Create your models here.
class UserModel(BaseModel):
    account=models.CharField(max_length=11,verbose_name="账号")
    nickname=models.CharField(max_length=20,verbose_name="昵称",null=True,blank=True)
    intro=models.CharField(max_length=100,verbose_name="简介",null=True,blank=True)
    sex=models.CharField(max_length=1,verbose_name="性别",null=True,blank=True)
    birthday=models.DateField(verbose_name="生日",null=True,blank=True)
    address=models.CharField(max_length=100,verbose_name="地址",null=True,blank=True)
    headimg=models.ImageField(upload_to="headimg",verbose_name="头像",null=True,blank=True)
    score=models.IntegerField(verbose_name="积分",default=0)
    class Meta:
        db_table="user"
    def __str__(self):
        return self.account

class FollowModel(BaseModel):
    follower = models.ForeignKey(UserModel, on_delete=models.CASCADE, related_name='follower')
    following = models.ForeignKey(UserModel, on_delete=models.CASCADE, related_name='following')
    class Meta:
        db_table="follow"
        unique_together = (('follower', 'following'),)